package com.concerneyes.mine.adapter.serviceCentre;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.concerneyes.R;

/**
 * Created by Administrator on 2017/6/21 0021.
 */

public class OnLineServiceAdapter extends BaseAdapter {
    private int[] listIcon;
    private Context context;
    private boolean isService;


    public OnLineServiceAdapter(Context context, boolean isService) {
        this.context = context;
        this.isService = isService;
        listIcon = new int[]{R.drawable.default_header, R.drawable.default_header, R.drawable.default_header, R.drawable.default_header, R.drawable.default_header, R.drawable.default_header, R.drawable.ic_checked};
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (position == 1){
            isService = false;
        }
        int layoutId = isService ? R.layout.view_chat_item_text_left : R.layout.view_chat_item_text_right;
        ViewHolder holder = new ViewHolder();
        convertView = LayoutInflater.from(context).inflate(layoutId, null);
        holder.header = (ImageView) convertView.findViewById(R.id.headerIv);
        holder.timeView = (TextView) convertView.findViewById(R.id.msgTimeTv);
        holder.msgView = (TextView) convertView.findViewById(R.id.textTv);
        holder.msgView.setText("您好");

        return convertView;
    }

    class ViewHolder {
        ImageView header;
        TextView timeView;
        TextView msgView;
    }
}
